/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Chat;


import java.io.*;
import java.net.Socket;
import java.util.ArrayList;
import javax.swing.JTextArea;


/**
 *
 * @author cart2r
 */
public class ClientMan extends Thread{
    private Socket client;
    private ObjectOutputStream out1;
    private ObjectInputStream in1;
    private static ArrayList clients;
    private JTextArea texto;

    public ClientMan(Socket client /*JTextArea texto*/) throws IOException {
        this.client=client;
      //  this.texto=texto;
         in1 = new ObjectInputStream(client.getInputStream());
         out1 = new ObjectOutputStream(client.getOutputStream());
        clients.add(this);



    }

    public void enviarMsg(String mens) throws IOException{
        out1.writeUTF(mens);

    }


    public void run() {
        while(true) {
            try {
                String entrada = in1.readUTF();
                enviarMsg(entrada);
               // texto.append(entrada);

            } catch (IOException ex) {

            }


        }



    }

    
    //private void procEntrada() throws IOException {
      //  String entrada = in1.readUTF();
       // System.out.println("recibido:"+entrada);

    //}


}